home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 12469 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  3.5 KB

  1. Path: inforamp.net!ts13-11
  2. From: rmorin@inforamp.net (Randy Charles Morin)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Coding Standards
  5. Date: Wed, 20 Mar 96 04:24:16 GMT
  6. Organization: MiddleWorld SoftWare
  7. Message-ID: <4io1a4$n9v@sam.inforamp.net>
  8. References: <4hj8ek$elu@sam.inforamp.net> <4hktar$5o2@galaxy.ucr.edu>
  9.     <4hmqol$97j@abacus.abasoft.co.uk> <4hsg8r$pmm@sam.inforamp.net>
  10.     <4i9o6j$p4l@daisy.pgh.wec.com> <4idskb$pc1@sam.inforamp.net> <CBARBER.96Mar18104644@figaro.bbn.com>
  11. NNTP-Posting-Host: ts34-09.tor.inforamp.net
  12. X-Newsreader: News Xpress Version 1.0 Beta #4
  13.  
  14. In article <CBARBER.96Mar18104644@figaro.bbn.com>,
  15.    cbarber@bbn.com (Christopher Barber) wrote:
  16. >    Randy> ------- -source files should have the extension .cc (not .cpp or
  17. >    Randy> .c).  I don't think I have to say anything here.
  18. >    Randy>     -header files should have the extension .hh (not .hpp or
  19. >    Randy> .h).  I don't think I have to say anything here.
  20. >    
  21. >Sure you do.  Do you really consider this an argument?
  22.  
  23. ???  Let's be reasonable.
  24.  
  25. >There is no such thing as "normal industry practices".  Although a bit
  26. >extreme, this convention does have some advantages: 
  27.  
  28. There is no such think as "normal industry practices?  Why?  Almost everybody 
  29. uses .h for headers and .cpp for source files.  This is a normal industry 
  30. practice.  Is it not?
  31.  
  32. >    Randy>     -a class which can be instantiated with a "new" must have a
  33. >    Randy> copy constructor, a destructor and an assignment operator
  34. >    Randy> definition.  Most compilers (if not all) supply default copy
  35. >    Randy> construtors.  Unless you think your class may have copy behavior
  36. >    Randy> problems, then writing copy constructors is redundant.  When you
  37. >    Randy> have 100+ classes to write and where the average copy
  38. >    Randy> constructor has 50 lines, you would need 100 hours to write the
  39. >    Randy> additional robustness (or cumbersomeness).
  40. >Aren't you getting a bit extreme here?  I have written hundreds of
  41. >copy constructors and only a handful came even close to 50 lines long.
  42. >Yes, the compiler will generate a copy constructor for you, but it
  43. >has the wrong behavior in many cases.
  44.  
  45. Where am I being a little extreme?  We do have 100+ classes, I have already 
  46. identified about 100.  I calculated the average amount of lines per copy 
  47. constructor in another project and it came out just below 50.  The average 
  48. programmer on that project wrote less than 50 lines an hour.  That's 100 
  49. hours.  It's math.
  50.  
  51. >    Randy>     -never use #define instead or const.  This is a good
  52. >    Randy> debate, but I still maintain that if your memory model and
  53. >    Randy> compiler make #define data text and const code text, then you
  54. >    Randy> cannot consider this a straight forward trade-off.
  55. >Didn't you say this was a Unix project?  There is no such thing
  56. >as a "memory model" in Unix.
  57.  
  58. First of all, you end the argument by accepting that the code will only run in 
  59. one environment.  These coding standards are for Unix, DOS, Windows 
  60. 95&NT, OS/2, etc.  Coding standards that apply in more than one environment, 
  61. should also work in more than one environment.  Second of all, this project 
  62. was originally specified in OS/2.  They respecified it as Windows 95 and they 
  63. want to port it to Mac and others.
  64.  
  65. >Anyway, enough of this.  Some of the rules are a bit extreme or silly.
  66. >But many are quite reasonable and you don't seem to be able to distinguish
  67. >between the two.
  68.  
  69. Again the hollier than thou attitude I talked about.  You can't just respond 
  70. in the negative, you have to try to insult me.  Just shows your maturity.
  71.  
  72. Agrivar
  73.